exports.main = async (event, context) => {
	const headName = 'im-going-up-the-wall-'
	console.log(event)
	// 解构赋值获取前端数据
	const {
		nick_name,
		content,
		images,
	} = event
	//返回数据类型
	const result = {
		code: 0,
		msg: "",
		data: {}
	}
	// 获取云云数据库实例对象
	const db = uniCloud.database();
	// 云函数向数据库中插入数据
	let res = await db.collection(headName + "dynamic").add({
		nick_name: nick_name,
		content: content,
		images: images,
		time: parseInt(new Date().getTime() / 1000)
	})
	if (res.id) {
		result.code = 1
		result.msg = "上墙成功"
		result.data = event
	} else {
		result.code = -1
		result.msg = "上墙失败"
		result.data = event
	}
	//返回数据给客户端
	return result
};